#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'test'
exit 1
}

while getopts  ":p:f:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

. $var

b450k_no_name=$data_path/methy/beta/b450k.no_name.txt
names=$data_path/methy/beta/b450k.names.txt

nf=`awk '{print NF; exit 0}' $b450k_no_name`
echo $nf

cv_pre1.py $nf $out_prefix.nf.txt

dos2unix $out_prefix.nf.txt

for nf in `cat $out_prefix.nf.txt`; do
    ((i+=1))
    cut -f $nf $b450k_no_name|paste $names - > $out_prefix.b450k.sub.${i}.txt
done

. $cmd_done